#!/bin/bash

# 测试 taos -s 允许的最大长度
set -e

user="root"
pwd="taosdata"
db="iot_ts"

# ------------------------------------------ 封装的函数 ------------------------------------------

function execute_sql(){
    local sql=$1
    echo "execute sql: $sql"
    taos -u "$user" "-p$pwd" -s "$sql"
}

select1="select 1; "
count=2
sql=""
for(( i = 0 ; i < count ; i++ ))
do
    sql="${sql}${select1}"
done

#printf "%s" "$select1" | wc -c

printf "%s" "$sql" | wc -c

execute_sql "$sql"

printf "%s" "$sql" | wc -c